package org.study.tk.boot.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import org.study.tk.boot.config.SnowflakeGenId;
import tk.mybatis.mapper.annotation.KeySql;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 测试自定义主键生成
 *
 * @author Administrator
 * @date 2021-04-20
 */
@Data
@Builder
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_demo")
public class TestModel implements Serializable {
    @Id
    @Column(name = "`id`")
    @KeySql(genId = SnowflakeGenId.class)
    private Long id;

    @Column(name = "`name`")
    private String name;

    @Column(name = "`create_time`")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
